﻿using AdverseEventReportSystem.BLL.ServiceReference1;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace AdverseEventReportSystem.Web.Areas.Personnel
{
    public class PersonnelSummaryController : BaseController
    {
        // GET: Personnel/PersonnelSummary
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 获取审核状态的汇总数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetStatusSummary()
        {
            FunctionAndPermissionsSoapClient service = new FunctionAndPermissionsSoapClient();
            ResultHelperOfListOfDataSummaryState serviceResult = service.getDataSummaryByP_Personnel1(loginUser.DepartCode);
            DataSummaryState[] list = null;
            if (serviceResult.S)
            {
                list = serviceResult.D;
            }

            return JsonDate(list);
        }

        /// <summary>
        /// 根据类型获取人员档案分析表
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public ActionResult GetPersonnelAnalysis(int type)
        {
            FunctionAndPermissionsSoapClient service = new FunctionAndPermissionsSoapClient();
            ResultHelperOfListOfDataSummary serviceResult = new ResultHelperOfListOfDataSummary();
            switch (type)
            {
                case 1:
                    serviceResult = service.getDataPositionByP_Personnel2(loginUser.DepartCode);
                    break;
                case 2:
                    serviceResult = service.getDataEnergyLevelByP_Personnel3(loginUser.DepartCode);
                    break;
                default:
                    break;
            }
            DataSummary[] list = null;
            if (serviceResult.S)
            {
                list = serviceResult.D;
            }

            return JsonDate(list);
        }
    }
}